package com.nbgroup.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.nbgroup.mapper.ReportActivityMapper;
import com.nbgroup.pojo.common.PageResult;
import com.nbgroup.pojo.dto.ReportActivityPageDto;
import com.nbgroup.pojo.vo.ReportActivityVo;
import com.nbgroup.service.ReportActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class ReportActivityServiceImpl implements ReportActivityService {

    @Autowired
    private ReportActivityMapper reportActivityMapper;


    @Override
    public PageResult listReport(ReportActivityPageDto dto) {

        PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
        Page<ReportActivityVo> p = reportActivityMapper.listReport(dto);
        PageResult pageResult = new PageResult();

        pageResult.setTotal(p.getTotal());
        pageResult.setRows(p.getResult());
        pageResult.setCode(200);
        pageResult.setMsg("查询成功");

        return pageResult;
    }
}
